﻿/// <reference path="underscore.js" />
/// <reference path="Animal.js" />
(function () {
	var animalsArray = [
		new Animal("Human", 2),
		new Animal("Cat", 4),
		new Animal("Tiger", 4),
        new Animal("Octopus", 8),
        new Animal("Chicken", 2)
	];

	function sumLegs(animals) {
	    return _.reduce(animals, function (memo, animal) {
	        return memo + animal.numberOfLegs;
	    }, 0);
	}

	console.log("Sum of all the legs of the animals: ");
	console.log(sumLegs(animalsArray));
})();